<!DOCTYPE html>
<html>
    <head>
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'workflowInstance.label', default: 'WorkflowInstance')}" />
        <title>工作流详情</title>
    </head>
    <body>
      <div class="small-header transition animated fadeIn">
          <div class="hpanel">
              <div class="panel-body">
                  <div id="hbreadcrumb" class="pull-right">
                      <ol class="hbreadcrumb breadcrumb">
                          <li>CINDATA PLS</li>
                          <li>
                              <g:link class="list" action="index">工作流</g:link>
                          </li>
                          <li class="active">
                              <span>${this.workflowInstance?.name}</span>
                          </li>
                      </ol>
                  </div>

                  <h2 class="font-light m-b-xs">
                      ${this.workflowInstance?.name}
                  </h2>
                  <small>
                      <span class="glyphicon glyphicon-cog"
                            aria-hidden="true"></span>${this.workflowInstance?.name}的信息</small>
              </div>
          </div>
      </div>

      <div class="content animate-panel">
          <div class="row">
              <div class="hpanel hred contact-panel">
                  <div class="panel-heading">
                      <div class="panel-tools">
                          <sec:ifNotGranted roles="ROLE_COO, ROLE_EVENT_CONFIGURATION,ROLE_CONDITION_RULEENGINE">
                              <g:link class="btn btn-info btn-xs" action="edit" resource="${this.workflowInstance}"><i class="fa fa-edit"></i>编辑</g:link>
                          </sec:ifNotGranted>
                      </div>
                      基本信息
                  </div>

                  <div class="panel-body">
                      <div class="text-muted font-bold m-b-xs ol-md-6">
                          <div class="col-md-12">
                              <h4>
                                  <a href=>${this.workflowInstance?.name}</a>
                              </h4>
                          </div>
                      </div>
                  </div>

                  <div class="panel-footer contact-footer">
                      <div class="row">

                          <div class="col-md-3 border-right">

                              <div class="contact-stat">
                                  <span>名称</span>
                                  <strong>${this.workflowInstance?.name}</strong>
                              </div>

                          </div>

                          <div class="col-md-3 border-right">

                              <div class="contact-stat">
                                  <span>工作流</span>
                                  <strong>${this.workflowInstance?.workflow?.name}</strong>
                              </div>

                          </div>

                          <div class="col-md-3 border-right">

                              <div class="contact-stat">
                                  <span>当前阶段</span>
                                  <strong>${this.workflowInstance?.stage?.name}</strong>
                              </div>

                          </div>

                          <div class="col-md-3 border-right">

                              <div class="contact-stat">
                                  <span>当前状态</span>
                                  <strong>${this.workflowInstance?.status?.name}</strong>
                              </div>

                          </div>

                      </div>
                  </div>
              </div>
          </div>


          <div class="row">
              <div class="hpanel hyellow">
                  <div class="panel-heading">
                      <div class="panel-tools">
                          <!-- <sec:ifNotGranted roles="ROLE_EVENT_CONFIGURATION,ROLE_CONDITION_RULEENGINE"> -->
                              <g:link class="btn btn-info btn-xs" controller="workflowInstanceStage" action="create"
                                      params="[instance: this.workflowInstance?.id]">
                                  <i class="fa fa-plus"></i>新增</g:link>
                          <!-- </sec:ifNotGranted> -->
                          <a class="showhide">
                              <i class="fa fa-chevron-up"></i>
                          </a>

                      </div>
                      工作流阶段
                  </div>

                  <div class="panel-body no-padding">
                      <div class="table-responsive">
                          <table class="table table-striped table-bordered table-hover">
                              <thead>
                              <tr>
                                <g:sortableColumn property="executionSequence"
                                title="${message(code: 'workflowInstanceStage.executionSequence.label', default: '执行次序')}"/>
                                  <g:sortableColumn property="name"
                                                    title="${message(code: 'workflowInstanceStage.name.label', default: '名称')}"/>
                                  <g:sortableColumn property="canReject"
                                                    title="${message(code: 'workflowInstanceStage.canReject.label', default: '能否回退')}"/>
                                  <g:sortableColumn property="opportunityLayout"
                                                    title="${message(code: 'workflowInstanceStage.opportunityLayout.label', default: '布局')}"/>
                                  <g:sortableColumn class="text-center" width="8%" property="operation"
                                                    title="${message(code: 'workflowInstanceStage.operation.label', default: '操作')}"/>
                              </tr>
                              </thead>
                              <tbody>
                              <g:each in="${this.workflowInstanceStages}">
                                  <tr>
                                    <td>
                                      <g:link controller="workflowInstanceStage" action="show" id="${it?.id}">${it?.executionSequence}</g:link>
                                    </td>
                                      <td>
                                          ${it?.name}
                                      </td>
                                      <td>${it?.canReject}</td>
                                      <td>${it?.layout?.description}</td>
                                      <td class="text-center">
                                          <sec:ifNotGranted roles="ROLE_EVENT_CONFIGURATION,ROLE_CONDITION_RULEENGINE">
                                              <g:form controller="workflowInstanceStage" action="delete" id="${it.id}" method="DELETE">
                                                    <button class="deleteBtn btn btn-danger btn-xs btn-outline" type="button">
                                                        <i class="fa fa-trash-o"></i> 删除
                                                    </button>
                                              </g:form>
                                          </sec:ifNotGranted>
                                      </td>
                                  </tr>
                              </g:each>
                              </tbody>
                          </table>
                      </div>
                  </div>
              </div>
          </div>

      </div>
      <script>
          $(function () {
              var listGroup = $(".panel-body .list-group");
              listGroup.each(function () {
                  if ($(this).children().length > 0) {
                      $(this).parent().prev(".panel-heading").removeClass("hbuilt");
                      $(this).parent().parent(".hpanel").removeClass("collapsed");
                  }
              });

          });
      </script>
    </body>
</html>
